import type { RouteRecordRaw } from 'vue-router';
import Layout from '@/layouts';

/**
 * 常驻路由
 * 除了 redirect/403/404/login 等隐藏页面，其他页面建议设置 Name 属性
 */
export const constantRoutes: RouteRecordRaw[] = [
  {
    path: '/redirect',
    component: Layout,
    meta: {
      hidden: true
    },
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/infra/redirect/index.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/sys/login/index.vue'),
    meta: {
      hidden: true,
      isWhite: true
    }
  },
  {
    path: '/register',
    component: () => import('@/views/infra/register/index.vue'),
    meta: {
      hidden: true,
      isWhite: true
    }
  },
  {
    path: '/401',
    name: '401',
    component: () => import('@/views/infra/error/401.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/403',
    name: '403',
    component: () => import('@/views/infra/error/403.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/infra/error/404.vue'),
    meta: {
      hidden: true
    }
  },
  {
    path: '/',
    name: 'Home',
    component: Layout,
    redirect: '/dashboard',
    meta: {
      title: '首页'
    },
    children: [
      {
        path: 'dashboard',
        name: 'Dashboard',
        component: () => import('@/views/infra/dashboard/index.vue'),
        meta: {
          hidden: true,
          activeMenu: '/'
        }
      }
    ]
  }
];

export const notFountRoute: RouteRecordRaw = {
  path: '/:path(.*)*',
  redirect: '/404',
  meta: { hidden: true }
};
